A better solution would be to modify the RandomPage class to allow passing pages of multiple namespaces, and giving it the complete list of content namespaces; then the selection would be properly proportional.
policies. This can be done only by users with the 'editrobots' permission
* Use $wgJobClasses to determine the correct Job to instantiate for a particular
queued task; allows extensions to introduce custom jobs
-* Special:Randompage with no parameters now selects a random page from any
- namespace in $wgContentNamespaces, rather than just from NS_MAIN.
== Bugfixes since 1.10 ==
global $wgOut, $wgContLang;
$rnd = new RandomPage();
-
- if ( $par == null ) {
- // Select a random content namespace to use.
- global $wgContentNamespaces;
- $n = array_rand( $wgContentNamespaces );
- $rnd->setNamespace( $wgContentNamespaces[$n] );
- }
- else {
- $rnd->setNamespace( $wgContLang->getNsIndex( $par ) );
- }
-
+ $rnd->setNamespace( $wgContLang->getNsIndex( $par ) );
$rnd->setRedirect( false );
$title = $rnd->getRandomTitle();